//传入组 
private ["_group", "_bClose", "_player","_player2", "_end", "_unit", "_count", "_group2", "_veh"];

//一直跟踪玩家，呼叫支援，直到死亡
_group = _this select 0;
_end = false;
_count = 0;


while {!_end} do
{
	
	_unit = leader _group;
	_veh = vehicle _unit;
	if(_count >= 30) exitWith
	{
		if(_veh != _unit) then {deleteVehicle _veh};
		
		{
			deleteVehicle _x;	
		}forEach units _group;	
	};
	if((isNull _unit) || {!alive _unit} || {isNull _group} || {count (units _group) == 0}) exitWith{};
	
	_player = objNull;
	//没倒的玩家
	private _list =  ((call fn_getPlayerRed)) select {alive _x && (_x getVariable ['FAR_isUnconscious',1] == 0)};
	{
		if((_x distance2D _unit) < 300) exitWith
		{
			_player = _x;
		};
		
	}forEach _list;
	
	_player2 = objNull;
	if(count _list > 0) then
	{
		_player2 = _list select 0;
	};
	//没有人 够近 就跟踪
	if(isNull _player) then
	{
		//删除所有路点
		while {(count (waypoints _group)) > 0} do
		{
			deleteWaypoint ((waypoints _group) select 0);
		};
		if !(isNull _player2) then
		{
			[_group, _player2, 64] call fn_addWaypoint;
		};		
	}
	else
	{
		private _cargos = crew _veh;
		_cargos = _cargos - [driver _veh, gunner _veh, commander _veh];

		{ 
			if ((typeOf _x) find "_PG_" > 0) then{
				unassignVehicle _x;
				moveOut _x;
				_x action ["OpenParachute", _x];
				Sleep 1;
			};
		} forEach _cargos;
		_cargos allowGetIn false;
		
		/*
		//十分钟才刷一次
		if(_count mod 10 == 0) then
		{
			if(call fn_canSpawnAI) then
			{
				[getPos _player] spawn fn_aiNeedSupport;
				//_group2 = [getPos _player, call fn_aiNum, 4, 600, 3]call fn_createGroup;
				//[_group2, _player] call fn_addWaypoint;
				//[_group2] spawn fn_controlGroup;
			};
			
		};
		
		//15分钟时刷突击队
		if(_count == 15) then
		{
			[getPos _player, 2] spawn fn_aiNeedSupport;
			//[selectRandom asg_normal, getPos _player] spawn fn_createG;
		};
		*/
	};
	Sleep 60;
	_count = _count + 1;
};

